﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ArriviSoft.SlotMachine.Model;

namespace ArriviSoft.SlotMachine.Presenter.Tests
{
    [TestClass]
    public class PresenterTests
    {
        [TestMethod]
        public void CreateInitializeCoins()
        {
            SlotMachinePresenter presenter = new SlotMachinePresenter(new MockView());

            Assert.AreEqual(0, presenter.Coins);

            presenter.InsertCoins(20);
            Assert.AreEqual(20, presenter.Coins);
        }

        [TestMethod]
        public void UnableToPlayWithoutCoins()
        {
            SlotMachinePresenter presenter = new SlotMachinePresenter(new MockView());

            Assert.IsFalse(presenter.CanPlay);

            presenter.InsertCoins(1);
            Assert.IsTrue(presenter.CanPlay);

        }

        [TestMethod]
        public void LooseOneGame()
        {
            ISlotGenerator generator = new MockGenerator(new int[] { 1, 2, 3 });
            ISlotValidator validator = new SlotValidator();
            SlotMachine.Model.SlotMachine machine = new Model.SlotMachine(generator, validator);
            SlotMachinePresenter presenter = new SlotMachinePresenter(machine, new MockView());
            presenter.InsertCoins(1);
            presenter.Play();
            
        }

    }
}
